package com.tvshows.front.view.recap;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;

import com.tvshows.front.listener.command.interfaces.RecapCommandListener;
import com.tvshows.front.ui.recap.UpsideCompositeRecapUI;
import com.tvshows.front.view.labels.FrontButton;

/**
 * @author Tangi Midy
 */
public class UpsideCompositeRecapView
    extends Composite
    implements UpsideCompositeRecapUI
{

    private FrontButton refreshStates;

    private FrontButton addShowRecap;

    private FrontButton deleteShowRecap;

    private FrontButton addLive;

    private FrontButton refreshList;

    private GridLayout gridLayout;

    private Text addShowInLive;

    private GridData addShowInLiveData;

    private RecapCommandListener recapListener;

    public UpsideCompositeRecapView( Composite parent, int style )
    {
        super( parent, style );
        initLayout();
        this.setLayout( gridLayout );
        initButtons();
    }

    private void initLayout()
    {
        gridLayout = new GridLayout( 2, true );
        gridLayout.verticalSpacing = 20;
        gridLayout.horizontalSpacing = 20;

        addShowInLiveData = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER );
        addShowInLiveData.heightHint = 20;
    }

    private void initButtons()
    {
        recapListener = new RecapCommandListener( this );

        deleteShowRecap = new FrontButton( this, SWT.NONE );
        deleteShowRecap.setText( "Supprimer la(les) série(s) sélectionnée(es)" );
        deleteShowRecap.addListener( SWT.Selection, recapListener );

        refreshList = new FrontButton( this, SWT.NONE );
        refreshList.setText( "Rafraîchir les favoris" );
        refreshList.setEnabled( true );
        refreshList.addListener( SWT.Selection, recapListener );

        addShowInLive = new Text( this, SWT.NONE );
        addShowInLive.setLayoutData( addShowInLiveData );
        addShowInLive.addListener( SWT.KeyUp, recapListener );

        addLive = new FrontButton( this, SWT.NONE );
        addLive.setText( "Ajouter ce lien directement" );
        addLive.setEnabled( false );
        addLive.addListener( SWT.Selection, recapListener );

    }

    public Composite getParent()
    {
        return super.getParent();
    }

    public Button getRefreshStates()
    {
        return refreshStates;
    }

    public Button getAddShowRecap()
    {
        return addShowRecap;
    }

    public Button getDeleteShowRecap()
    {
        return deleteShowRecap;
    }

    public Button getAddLive()
    {
        return addLive;
    }

    public Text getAddShowInLive()
    {
        return addShowInLive;
    }

    public GridData getAddShowInLiveData()
    {
        return addShowInLiveData;
    }

    /**
     * @return the refreshList
     */
    public Button getRefreshList()
    {
        return refreshList;
    }

    @Override
    public void initFormData()
    {

    }

    @Override
    public void initComposites()
    {

    }

}
